#include "ax_fork.h"
#include "com.h"
#include "ax_printf.h"
#include <stdio.h>
#include <unistd.h>
typedef struct
{
    int a;
}test_param;

static int test_fun(void* data)
{
    test_param* p = (test_param*)data;
    for(int i=0;i<10;i++)
    {
        ax_info("new pid:%d data:%d\n", getpid(),p->a);
        sleep(1);
    }
    return 100;
}
int main(int argc,char** argv)
{
    test_param* p = ALLOC(test_param);
    p->a = 1;
    ax_fork* f = ax_fork_create();
    ax_fork_run(f,test_fun,p);
    sleep(1);
    ax_fork_kill(f);
    ax_fork_wait(f);
    ax_fork_destroy(f);
    ax_info("ax_fork test done!\n");
    while(1)
        sleep(1);
    return 0;
}
